package org.example.springboot.enumClass;

import lombok.Getter;

/**
 * 用户行为类型枚举
 */
@Getter
public enum BehaviorType {
    VIEW(1, "浏览"),
    BORROW(2, "借阅"),
    COLLECT(3, "收藏"),
    RATE(4, "评分"),
    COMMENT(5, "评论");
    
    private final Integer value;
    private final String desc;
    
    BehaviorType(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }
    
    public static String getDescByValue(Integer value) {
        for (BehaviorType type : BehaviorType.values()) {
            if (type.getValue().equals(value)) {
                return type.getDesc();
            }
        }
        return null;
    }
}